import json

def loadFromFile(fnm):
    with open(fnm) as f:
        return f.read()

def writeToFile(fnm, content):
    with open(fnm, "w") as f:
        f.write(content)

def loadCSV(a):
    ret = []
    for i in a.split():
        tmp = []
        for j in i.split(","):
            tmp += [j]
        ret += [tmp[:]]
    return ret

tableList = ["user", "student", "volunteer", "stu_vol", "class_vol"]

r = {}

for i in tableList:
    r[i] = loadCSV(loadFromFile(input("Please input csvName of %s: " % i)))

writeToFile(input("Output filename: "), json.dumps(r))
